package com.dingteam.question.common.validation.module;

import com.dingteam.model.Result;
import com.dingteam.question.common.dto.QuestionPaperVerifyDTO;
import com.dingteam.question.common.dto.QuestionResultVerifyDTO;
import org.apache.commons.lang3.StringUtils;

/**
 * 页面组件
 * @author Jamin
 * @date 2019/08/14
 */
public abstract class AbstractModulePageValidator implements ModuleValidator {

	protected Result<String> validCreateCommon(QuestionPaperVerifyDTO.QuestionItemDTO itemDTO) {
		if (StringUtils.isBlank(itemDTO.getContent())) {
			return Result.error("{validation.item.content.message}", EMPTY);
		}
		return Result.ok().build();
	}

	protected Result<String> validSubmitCommon(QuestionResultVerifyDTO.ItemResultDTO item) {
		item.setRemove(true);
		return Result.ok().build();
	}
}
